/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package control_escolar;

import static control_escolar.inicio.constancia_inicio;
import static control_escolar.log.claves_sesion2;
import static control_escolar.log.expedientes;
import java.awt.Image;
import java.awt.Toolkit;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author francisco
 */
public class kardex extends javax.swing.JFrame {

    /**
     * Creates new form kardex
     */
    public kardex() throws IOException {
        initComponents();
        setLocationRelativeTo(null);
        llenar_kardex();
        kardex_Tabla();
        kardex_table();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    public Image getIconImage() {
        Image retValue = Toolkit.getDefaultToolkit().getImage(ClassLoader.getSystemResource("umbrella-corp-2-icon.png"));
        return retValue;
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        NExpAlumno = new javax.swing.JTextField();
        NombreAlumno = new javax.swing.JTextField();
        Semestre_alumno = new javax.swing.JTextField();
        regresar_inicio = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        kardex = new javax.swing.JTable();
        jLabel10 = new javax.swing.JLabel();
        Promedio_aritmetico = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Kardex del Alumno");
        setIconImage(getIconImage());
        setResizable(false);

        jLabel1.setText("N° Expediente");

        jLabel2.setText("Nombre Alumno");

        jLabel3.setText("Semestre");

        NExpAlumno.setEnabled(false);
        NExpAlumno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                NExpAlumnoActionPerformed(evt);
            }
        });

        NombreAlumno.setEnabled(false);
        NombreAlumno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                NombreAlumnoActionPerformed(evt);
            }
        });

        Semestre_alumno.setEnabled(false);
        Semestre_alumno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Semestre_alumnoActionPerformed(evt);
            }
        });

        regresar_inicio.setText("Regresar");
        regresar_inicio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                regresar_inicioActionPerformed(evt);
            }
        });

        kardex.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "Clave_de_Materia", "Nombre_de_Materia", "Creditos", "Calificacion", "Semestre", "Tipo_de_Evaluacion"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        kardex.setEnabled(false);
        jScrollPane2.setViewportView(kardex);

        jLabel10.setText("Promedio Aritmetico");

        Promedio_aritmetico.setEnabled(false);

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel5.setText("Escuela Superior Big Citrus.");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 846, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel10))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(Promedio_aritmetico, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE)
                            .addComponent(Semestre_alumno))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(regresar_inicio)
                        .addGap(142, 142, 142))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel2))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(NExpAlumno, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(NombreAlumno, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel5)
                .addGap(291, 291, 291))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel5)
                .addGap(8, 8, 8)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(NExpAlumno))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(NombreAlumno))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(Semestre_alumno, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(8, 8, 8)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(Promedio_aritmetico)
                    .addComponent(regresar_inicio))
                .addContainerGap(21, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void NombreAlumnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NombreAlumnoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_NombreAlumnoActionPerformed

    private void Semestre_alumnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Semestre_alumnoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_Semestre_alumnoActionPerformed

    private void regresar_inicioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_regresar_inicioActionPerformed
        // TODO add your handling code here:
        validando();
    }//GEN-LAST:event_regresar_inicioActionPerformed

    private void NExpAlumnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NExpAlumnoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_NExpAlumnoActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(kardex.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(kardex.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(kardex.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(kardex.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    new kardex().setVisible(true);
                } catch (IOException ex) {
                    Logger.getLogger(kardex.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField NExpAlumno;
    private javax.swing.JTextField NombreAlumno;
    private javax.swing.JTextField Promedio_aritmetico;
    private javax.swing.JTextField Semestre_alumno;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JScrollPane jScrollPane2;
    public static javax.swing.JTable kardex;
    private javax.swing.JButton regresar_inicio;
    // End of variables declaration//GEN-END:variables

    public void llenar_kardex() {
        String EXP = Busqueda_kardex.numex_alumno.getText();
        try {
            BufferedReader br = new BufferedReader(new FileReader("src/ArchivosTXT/Alumnos.txt"));
            String expediente;
            while ((expediente = br.readLine()) != null) {
//en line se pone la línea y haces lo que necesites con ella
                if (expediente.startsWith(EXP)) {
                    String[] alumno = expediente.split(";");
                    NExpAlumno.setText(alumno[0]);
                    NombreAlumno.setText(alumno[1] + " " + alumno[2] + " " + alumno[3]);
                }
            }
        } catch (IOException x) {
            x.printStackTrace();
        }
    }

    private void kardex_Tabla() throws IOException {
        String EXP = Busqueda_kardex.numex_alumno.getText();
        int o = 0;
        int u = 0;
        int i = 0;
        int z = 0;
        String abecedario[] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};

        String expediente;
        try {
//columna clave de la materia            
            BufferedReader clave = new BufferedReader(new FileReader("src/ArchivosTXT/Alta_Materia.txt"));
            while ((expediente = clave.readLine()) != null) {
                if (expediente.startsWith(EXP)) {
                    String[] clave_materia = expediente.split(";");
                    kardex.setValueAt(clave_materia[1], o, 0);
                    kardex.paintImmediately(kardex.getX(), kardex.getY(), kardex.getWidth(), kardex.getHeight());
                    o = o + 1;
//columna nombre de la materia
                    BufferedReader nombre = new BufferedReader(new FileReader("src/ArchivosTXT/Materias.txt"));
                    while ((expediente = nombre.readLine()) != null) {
                        if (expediente.startsWith(clave_materia[1])) {
                            String[] datos_materias = expediente.split(";");
                            kardex.setValueAt(datos_materias[1], u, 1);
                            kardex.paintImmediately(kardex.getX(), kardex.getY(), kardex.getWidth(), kardex.getHeight());
                            u = u + 1;
//columna creditos de la materia
                            BufferedReader credito = new BufferedReader(new FileReader("src/ArchivosTXT/Materias.txt"));
                            while ((expediente = credito.readLine()) != null) {
                                if (expediente.startsWith(clave_materia[1])) {
                                    kardex.setValueAt(datos_materias[2], i, 2);
                                    kardex.paintImmediately(kardex.getX(), kardex.getY(), kardex.getWidth(), kardex.getHeight());
                                    i = i + 1;
//columna semestre de cada materia del archivo materias                                    
                                    BufferedReader semestre = new BufferedReader(new FileReader("src/ArchivosTXT/Materias.txt"));
                                    while ((expediente = semestre.readLine()) != null) {
                                        if (expediente.startsWith(clave_materia[1])) {
                                            String[] semestre_al = expediente.split(";");
                                            Semestre_alumno.setText(semestre_al[3]);
                                            kardex.setValueAt(semestre_al[3], z, 4);
                                            kardex.paintImmediately(kardex.getX(), kardex.getY(), kardex.getWidth(), kardex.getHeight());
                                            z = z + 1;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        } catch (FileNotFoundException ex) {
            Logger.getLogger(kardex.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void kardex_table() throws IOException {
        String EXP = Busqueda_kardex.numex_alumno.getText();
        int z = 0;
        int p = 0;
        int J = 0;
        int total = 0;
        int total_materias = 0;
        int promedio = 0;


        String expediente;
        String abecedario[] = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};

        try {
//columna calificaciones de la materia            
            BufferedReader calificacion = new BufferedReader(new FileReader("src/ArchivosTXT/Calificaciones.txt"));
            while ((expediente = calificacion.readLine()) != null) {
                if (expediente.startsWith(EXP)) {
                    expediente = expediente.replace(EXP, "");
                    for (int l = 0; l < abecedario.length; l++) {
                        expediente = expediente.toLowerCase().replace(abecedario[l], "");

                    }
                    String[] cadena = expediente.split(";");
                    kardex.setValueAt(cadena[5], z, 3);
                    kardex.getValueAt(z, 3);
                    kardex.paintImmediately(kardex.getX(), kardex.getY(), kardex.getWidth(), kardex.getHeight());
                    total = total + Integer.parseInt(cadena[5]);
                    z = z + 1;
                    p = p + 1;
                }
            }
            total_materias = total_materias + z;
            promedio = total / total_materias;
            String promedio_ari = Integer.toString(promedio);

            Promedio_aritmetico.setText(promedio_ari);
//columna tipo de evaluacion cursada del archivo calificaciones  
            BufferedReader tipo_evaluacion = new BufferedReader(new FileReader("src/ArchivosTXT/Calificaciones.txt"));
            while ((expediente = tipo_evaluacion.readLine()) != null) {
                if (expediente.startsWith(EXP)) {
                    expediente = expediente.replace(EXP, "");
                    String[] cadena = expediente.split(";");


                    kardex.setValueAt(cadena[8], J, 5);
                    kardex.paintImmediately(kardex.getX(), kardex.getY(), kardex.getWidth(), kardex.getHeight());
                    J = J + 1;

                    //for (int z1=0;z1<cadena.length;z1++){
                    //System.out.println(cadena[z1]);}
                }
            }

        } catch (FileNotFoundException ex) {
            Logger.getLogger(kardex.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

   public void validando() {
        String EXP = log.expedientes.getText();
        String pwd = log.claves_sesion2.getText();
        if (expedientes.getText().length() != 0 && claves_sesion2.getText().length() != 0) {
            try {

                BufferedReader alumnos = new BufferedReader(new FileReader("src/ArchivosTXT/Alumnos.txt"));
                String Materias;
                while ((Materias = alumnos.readLine()) != null) {

                    if (Materias.startsWith(EXP)) {
                        String[] Al = Materias.split(";");
                        if (Al[0].equals(EXP) && Al[22].equals(pwd)) {
                            
                            new inicio().setVisible(true);
                            this.setVisible(false);
                            inicio.constancia_inicio.setVisible(false);
                            inicio.reporte1.setVisible(false);
                            inicio.reporte2.setVisible(true);
                            inicio.reporte3.setVisible(false);
                            inicio.kardex_inicio.setVisible(true);
                            inicio.jMenu2.setVisible(false);
                        } else {
                            JOptionPane.showMessageDialog(null, "Datos Erroneos");
                        }
                    }
                }

                BufferedReader maestros = new BufferedReader(new FileReader("src/ArchivosTXT/Maestros.txt"));
                String Maestros;
                while ((Maestros = maestros.readLine()) != null) {
                    if (Maestros.startsWith(EXP)) {
                        String[] Ma = Maestros.split(";");
                        if (Ma[0].equals(EXP) && Ma[12].equals(pwd)) {
                            
                            new inicio().setVisible(true);
                            this.setVisible(false);
                            inicio.constancia_inicio.setVisible(false);
                            inicio.reporte1.setVisible(false);
                            inicio.reporte2.setVisible(true);
                            inicio.reporte3.setVisible(false);
                            inicio.kardex_inicio.setVisible(false);
                            inicio.jMenu2.setVisible(true);
                            inicio.alumno_inicio.setVisible(false);
                            inicio.maestro_inicio.setVisible(false);
                            inicio.materia_inicio.setVisible(false);
                            inicio.Calificaciones.setVisible(true);
                            inicio.jMenuItem6.setVisible(false);
                            //inicio.jMenuItem7.setVisible(false);

                        } else {
                            JOptionPane.showMessageDialog(null, "Datos Erroneos");
                        }
                    }
                }
                if (EXP.equals("Admin") && pwd.equals("Citrus")) {
                    
                    new inicio().setVisible(true);
                    this.setVisible(false);
                    constancia_inicio.setVisible(true);
                    inicio.reporte1.setVisible(true);
                    inicio.reporte2.setVisible(true);
                    inicio.reporte3.setVisible(true);
                    inicio.kardex_inicio.setVisible(true);
                    inicio.jMenu2.setVisible(true);
                    inicio.alumno_inicio.setVisible(true);
                    inicio.maestro_inicio.setVisible(true);
                    inicio.materia_inicio.setVisible(true);
                    inicio.Calificaciones.setVisible(true);
                    inicio.jMenuItem4.setVisible(true);
                    inicio.jMenuItem6.setVisible(true);
                    inicio.jMenuItem7.setVisible(true);
                } else {
                    JOptionPane.showMessageDialog(null, "Datos Erroneos");
                }
            } catch (IOException x) {
            }
        } else {
            JOptionPane.showMessageDialog(null, "Campos Requeridos");
        }
}
}
